<!-- 城市选择器 -->
<!-- 城市选择器 -->
<!-- 城市选择器 -->
<template>
  <el-cascader class="el-date-picker" v-bind="props" :options="options" @change="change"></el-cascader>
</template>

<script setup lang="ts">
  import { type CascaderValue, ElCascader, cascaderProps } from 'element-plus';
  import ChinaArea from './ChinaArea';

  const props = defineProps({
    ...cascaderProps,
    /** 是否有全部按钮 */
    isall: { type: Boolean, default: false },
    /** 层级 */
    leave: { type: Number, default: 3 },
  });

  const chinaArea = new ChinaArea({ leave: props.leave ?? 3, isall: props.isall });

  const options = chinaArea.chinaData();

  /**
   * ss
   */
  function change(event: CascaderValue) {
    console.log('城市====', event);
  }
</script>
